
<title>柱状图</title>

<div class="layui-card layadmin-header">
    <div class="layui-breadcrumb" lay-filter="breadcrumb">
        <a lay-href="">主页</a>
        <a><cite>高级</cite></a>
        <a><cite>Echarts集成</cite></a>
        <a><cite>柱状图</cite></a>
    </div>
</div>

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">标准柱状图</div>
                <div class="layui-card-body">

                    <div class="layui-carousel layadmin-carousel layadmin-dataview" data-anim="fade" lay-filter="LAY-index-normcol">
                        <div carousel-item id="LAY-index-normcol">
                            <div><i class="layui-icon layui-icon-loading1 layadmin-loading"></i></div>
                        </div>
                    </div>

                </div>
            </div>
        </div>

    </div>
</div>

<script>

    //区块轮播切换
    layui.use(['admin', 'carousel', 'echarts','coreHelper'], function () {
        var $ = layui.$
            , admin = layui.admin
            , carousel = layui.carousel
            , element = layui.element
            , echarts = layui.echarts
            , coreHelper = layui.coreHelper
            , device = layui.device();

        //轮播切换
        $('.layadmin-carousel').each(function () {
            var othis = $(this);
            carousel.render({
                elem: this
                , width: '100%'
                , arrow: 'none'
                , interval: othis.data('interval')
                , autoplay: othis.data('autoplay') === true
                , trigger: (device.ios || device.android) ? 'click' : 'hover'
                , anim: othis.data('anim')
            });
        });

        //标准柱状图

        coreHelper.Post("Api/Echarts/BarDemo", {}, function (res) {
            if (res.code == 0) {

                var echnormcol = [], normcol = res.data, elemNormcol = $('#LAY-index-normcol').children('div')
                    , renderNormcol = function (index) {
                        echnormcol[index] = echarts.init(elemNormcol[index], layui.echartsTheme);
                        echnormcol[index].setOption(normcol[index]);
                        window.onresize = echnormcol[index].resize;
                    };
                if (!elemNormcol[0]) return;
                renderNormcol(0);



            } else {
                layer.msg(res.msg);
            }            
        });



    });



</script>